'''
 虚拟环境：  !/usr/bin/env python
 -*- coding: utf-8 -*-
 @Time    : 2025/1/14 01:00
 @Author  : 小呆呆不爱睡觉
 @File    : 字符串拼接.py
 @Software: PyCharm
 @Project_name:pythonProject113
 '''
str1 = "Hello"
str2 = "World"
result = str1 + " " + str2
print(result)
print('------------------------请继续练习吧，主人----------------------------')

str_list = ["This", "is", "a", "test"]
result = " ".join(str_list)
print(result)
print('------------------------请继续练习吧，主人----------------------------')
name = "Alice"
age = 25
result = "My name is %s and I am %d years old." % (name, age)
print(result)
print('------------------------请继续练习吧，主人----------------------------')
# 格式化占位符
name = "Bob"
age = 30
result = f"My name is {name} and I am {age} years old."
print(result)

print('------------------------请继续练习吧，主人----------------------------')
x = 10
y = 20
result = f"The sum of {x} and {y} is {x + y}"
print(result)

print('------------------------请继续练习吧，主人----------------------------')
str1 = "=" * 20
str2 = "Title" * 2
str3 = "=" * 20
result = str1 + str2 + str3
print(result)

print('------------------------请继续练习吧，主人----------------------------')
name = "John"
age = 25
result = "My name is {} and I am {} years old.".format(name, age)
print(result)

byte_str = b'hello'
s = ' world'
decoded_byte_str = byte_str.decode('utf - 8')
result = decoded_byte_str + s
print(result)
